package router

import (
	"github.com/gin-gonic/gin"
	"user/controller"
	"user/middleware"
)

func Router(r *gin.Engine) *gin.Engine {
	//r.Use(gin.Logger(), middleware.RecoverMiddleware())
	r.Use(gin.Logger())
	api := r.Group("/api")
	{
		api.POST("/register", controller.Register)
		api.POST("/login", middleware.RecoverMiddleware(), controller.Login)
		api.GET("/user/info", middleware.AuthMiddleware(), controller.Info)
		api.GET("/test", controller.Test)
	}
	return r
}
